import Vue from 'vue'
import App from './App.vue'
import router from './router'
import './plugins/element.js'
import './assets/css/global.css'
import './assets/fonts/iconfont.css'
import axios from 'axios'
import ZkTable from 'vue-table-with-tree-grid'
import { cloneDeep } from 'lodash'
Vue.component('tree-grid', ZkTable)
axios.defaults.baseURL = 'https://www.liulongbin.top:8888/api/private/v1/'
axios.interceptors.request.use(config => {
  console.log(config)
  config.headers.Authorization = window.sessionStorage.getItem('token')
  // 最后必须return出 config
  return config
})
Vue.prototype.$axios = axios
Vue.prototype.cloneDeep = cloneDeep
Vue.config.productionTip = false
// 定义时间过滤器
Vue.filter('dateFormat', date => {
  const newData = new Date(date * 1000)
  const y = newData.getFullYear()
  const m = newData.getMonth() + 1
  const d = newData.getDate()
  const HH = newData.getHours()
  const MM = newData.getMinutes()
  const SS = newData.getSeconds()
  return y + '-' + m + '-' + d + ' ' + HH + ':' + MM + ':' + SS
})
new Vue({
  router,
  render: h => h(App)
}).$mount('#app')
